package com.freemypay.test.并发.sleep;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import com.freemypay.test.并发.定义任务.LiftOff;

public class SleepingTask extends LiftOff {
	public void run() {
		while(countDown --> 0) {
			try {
				System.out.println(status() + Thread.currentThread().getName());
//				Thread.sleep(1000);
				TimeUnit.MILLISECONDS.sleep(500);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args) {
		ExecutorService excu = Executors.newCachedThreadPool();
		for(int i = 0; i < 5; i++) 
			excu.execute(new SleepingTask(10));
		excu.shutdown();
	}

	public SleepingTask(int countDown) {
		super(countDown);
	}
	
	

}
